#include "stack.h"
// #include "stack.cpp"


int main()
{
    int m,j = 0,i=0;
    char n;
    char q[20];
    SqStack *s;
    printf("(1)初始化栈！\n");
    InitStack(s); 

    
    printf("(2)判断栈是否为空：\n");
    if(StackEmpty(s)){
        printf("栈为空\n");
    }else{
        printf("栈不为空\n");
    }


    printf("(3)请输入要入栈的元素：以*结束\n");
    scanf("%s",&q);
    
    int a = 0;
    while(q[a] != '*'){
        Push(s,q[a]);
        a++;
    }

    printf("(4)显示栈内的元素：\n");
    DispStack(s);


    printf("(5)栈的长度为：%d\n", StackLength(s));

    printf("(6)请输入想要进行的出栈次数：\n");
    ElemType e = 'a';
    scanf("%d",&i);
    if(i > StackLength(s)){
        printf("(7)出栈次数超出栈的长度\n");
        printf("(10)销毁栈！");
        DestroyStack(s);
        return 0;
    }
    for(i;i>0;i--){
        Pop(s,e);
    }
        printf("(8)出栈操作以后：\n");
        DispStack(s);

        printf("(9)出栈后栈的长度为：%d\n",StackLength(s));
    
    printf("(10)销毁栈！");
    DestroyStack(s);
    return 0;
}



